
import 'package:example/demo/page_normal.dart';
import 'package:flutter/material.dart';
import 'package:flutter_base_app/base/base_page.dart';
import 'package:flutter_base_app/base/base_page_view_model.dart';

class PageAnimationTest extends StatefulWidget {
  const PageAnimationTest({super.key});

  @override
  State<PageAnimationTest> createState() => _PageAnimationTestState();
}

class _PageAnimationTestState extends BasePageState<BasePageViewModel, PageAnimationTest> with SingleTickerProviderStateMixin {

  late AnimationController animationController;

  @override
  void initState() {
    super.initState();
    animationController = AnimationController(vsync: this, duration: Duration(seconds: 320));
    animationController.addListener((){
      print("ziq ${animationController.value}");
    });
    animationController.addStatusListener((status){
      print("ziq status ${status}");
    });
    animationController.forward(from: 0);
  }

  @override
  void dispose() {
    animationController.dispose();
    super.dispose();
  }

  @override
  BasePageViewModel createViewModel() {
    return BasePageViewModel();
  }

  @override
  Widget buildContent(BuildContext context) {
    return Container(
      child: Center(
        child: GestureDetector(
          onTap: (){
            Navigator.of(context).push(MaterialPageRoute(builder: (context){
              return PageNormal();
            }));
          },
          child: Container(
            width: 100,
              height: 100,
            color: Colors.red,
          ),
        ),
      ),
    );
  }
}
